﻿<UserControl xmlns:PageBar="clr-namespace:Mengsk.ProxyDelivery.App.UI.PageBar"  x:Class="Mengsk.ProxyDelivery.App.UI.Seller.SellerLoginUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="1000" Loaded="UserControl_Loaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <TextBlock Text="卖家编号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbSellerId" Margin="3" Width="100" VerticalAlignment="Center"/>
            <TextBlock Text="登录 IP:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbIP" Margin="3" Width="100" VerticalAlignment="Center"/>
            <TextBlock Text="登录结果:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Margin="3" VerticalAlignment="Center" Name="cbbResults">
                <ComboBoxItem>所有</ComboBoxItem>
                <ComboBoxItem>失败</ComboBoxItem>
                <ComboBoxItem>成功</ComboBoxItem>
                <ComboBox.SelectedIndex>0</ComboBox.SelectedIndex>
            </ComboBox>
            <TextBlock Text="登录时间：" Margin="3" VerticalAlignment="Center"/>
            <DatePicker Name="dpStart" Margin="3" VerticalAlignment="Center" Width="130"/>
            <TextBlock Text="到：" Margin="3" VerticalAlignment="Center"/>
            <DatePicker Name="dpEnd" Margin="3" VerticalAlignment="Center" Width="130"/>
            <Button Name="btnQuery" Content="查询" Margin="3" VerticalAlignment="Center" Click="btnQuery_Click" Width="60"/>
            <Button Name="btnDelete" Content="删除" Margin="3" VerticalAlignment="Center" Click="btnDelete_Click" Width="60"/>
        </StackPanel>

        <DataGrid Grid.Row="1" GridLinesVisibility="All" Name="dgvLoginHistories" AutoGenerateColumns="False" IsReadOnly="True">
            <DataGrid.Columns>
                <DataGridTextColumn Header="编号" Binding="{Binding Path=Id}"/>
                <DataGridTextColumn Header="卖家编号" Binding="{Binding Path=SellerId}"/>
                <DataGridTextColumn Header="IP地址" Binding="{Binding Path=IPAddress}"/>
                <DataGridTextColumn Header="方式" Binding="{Binding Path=Source,Converter={StaticResource descriptionConverter}}"/>
                <DataGridTextColumn Header="时间" Binding="{Binding Path=Time,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
                <DataGridTextColumn Header="结果" Binding="{Binding Path=Result,Converter={StaticResource intConverter},ConverterParameter=失败|成功}"/>
                <DataGridTextColumn Header="描述" Binding="{Binding Comment}"/>
            </DataGrid.Columns>
        </DataGrid>

        <PageBar:PageBarUserControl x:Name="pageBar" Grid.Row="2" PageSize="200" PageChanging="pageBar_PageChanging" />
    </Grid>
</UserControl>
